﻿using System.Data.Entity.ModelConfiguration;
using QDT.Core.Deals;

namespace QDT.Core.MSData.Mapping
{
    public class CreditMapping : EntityTypeConfiguration<Credit>
    {
        public CreditMapping()
        {
            HasKey(x => x.ID);
            Property(x => x.InnerType).HasColumnName("Type");
            Property(x => x.InnerStatus).HasColumnName("Status");
            Ignore(x => x.Type);
            Ignore(x => x.Status);

            HasMany(x => x.Repayments).WithRequired().HasForeignKey(x => x.CreditId);

            ToTable(DB.TPref("credit"));
        }
    }
}
